using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class BeginStock_Detail
    {
            public long ID{get;set;}
            public long ProductID{get;set;}
            public long UnitID{get;set;}
            public int OldQuantity{get;set;}
            public int NewQuantity{get;set;}
            public long BeginStockID{get;set;}

            public string ProductNameExt { get; set; }
            public string UnitNameExt { get; set; }
            public string ProductGroupExt { get; set; }
            public string ProductCodeExt { get; set; }
            public decimal PriceExt { get; set; }
         
        public BeginStock_Detail()
        {       
        }
        
       static BeginStock_Detail DynamicCast<T>(object row_data, object row_header) where T : BeginStock_Detail
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           BeginStock_Detail ret = new BeginStock_Detail();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "ProductID":
                        ret.ProductID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "UnitID":
                        ret.UnitID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "OldQuantity":
                        ret.OldQuantity = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "NewQuantity":
                        ret.NewQuantity = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "BeginStockID":
                        ret.BeginStockID = ConvertObject.ToLong(dt[column]);
                        break;
                      case "ProductName":
                        ret.ProductNameExt = ConvertObject.ToString(dt[column]);
                        break;
                      case "ProductCode":
                        ret.ProductCodeExt = ConvertObject.ToString(dt[column]);
                        break;
                      case "ProductGroup":
                        ret.ProductGroupExt = ConvertObject.ToString(dt[column]);
                        break;
                      case "UnitName":
                        ret.UnitNameExt = ConvertObject.ToString(dt[column]);
                        break;
                      case "Price":
                        ret.PriceExt = ConvertObject.ToDecimal(dt[column]);
                        break;
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
